<template>
  <div class="gallary-wrap" @click="handleGallaryClose">
    <div class="container">
      <swiper :options="swiperOptions">
        <swiper-slide v-for="(item,index) of imgs" :key="index">
          <img :src="item"
               class="swiper-img">
        </swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'gallary',
  props: {
    imgs: {
      type: Array
    }
  },
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    handleGallaryClose () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .gallary-wrap >>>.swiper-container
    overflow: inherit

  .gallary-wrap
    display: flex
    flex-direction column
    justify-content center
    position: fixed
    top: 0
    left: 0
    bottom: 0
    right: 0
    background #000
    z-index 99

  .container
    width: 100%
    height: 0
    padding-bottom: 100%

  .swiper-img
    display: block
    width: 100%

  .swiper-pagination
    bottom: -1rem
    color: #fff
</style>
